package com.woniuxy.controller;


import com.woniuxy.entity.dto.CustomerManagementDTO;
import com.woniuxy.service.CustomerManagementService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/customerManagement")
public class CustomerManagementController {
    // 用来处理客户管理表中的各种操作
    @Autowired
    private CustomerManagementService customerManagementService;

    // 用来查询的
    @PostMapping("/queryCustomer")
    public ResponseData<?> queryCustomer(@RequestBody PageData<CustomerManagementDTO> pageData) {
        return customerManagementService.queryCustomer(pageData);
    }



    @GetMapping("/deleteCustomer/{id}")
    public ResponseData<?> deleteCustomer(@PathVariable("id") Integer id) {
        System.out.println("Received delete request for customer id: " + id);
        return customerManagementService.deleteCustomer(id);
    }
}
